package me.zhengjie.modules.vip.domain;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;

import javax.validation.constraints.NotBlank;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.List;

/**
* @description /
* @author ck
* @date 2024-12-20
**/
@Data
@TableName("members")
public class Members implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "id")
    private Long id;

    @NotBlank
    @ApiModelProperty(value = "会员姓名")
    private String name;

    @NotBlank
    @ApiModelProperty(value = "手机号")
    private String phone;

    @ApiModelProperty(value = "会员卡号列表")
    @TableField(exist = false)
    private List<String> cardIds;

    @ApiModelProperty(value = "会员等级ID")
    private Integer levelId;

    @ApiModelProperty(value = "当前积分")
    private Integer currentPoints;

    @ApiModelProperty(value = "备注")
    private String remarks;

    @ApiModelProperty(value = "创建时间")
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    private Timestamp createdAt;

    @ApiModelProperty(value = "更新时间")
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    private Timestamp updatedAt;

    @ApiModelProperty(value = "会员卡信息")
    @TableField(exist = false)
    private List<MemberCards> memberCards;

    @ApiModelProperty(value = "会员等级信息")
    @TableField(exist = false)
    private MemberLevels memberLevels;

    public void copy(Members source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
